//
//  B_BusinessShopVC.m
//  DreamOf
//
//  Created by 薛小刚 on 2018/9/22.
//  Copyright © 2018年 薛小刚. All rights reserved.
//
/// 商家管理
#import "B_BusinessShopVC.h"
#import "B_BusinessHeaderView.h"
#import "B_BusinessLiseTVC.h"

@interface B_BusinessShopVC ()

@property (nonatomic, strong) BaseTableView * mainView;

@end

@implementation B_BusinessShopVC

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view = self.mainView;
}

- (BaseTableView *)mainView {
    if (!_mainView) {
        WeakSelf(weSelf, self);
        _mainView = [[BaseTableView alloc] init];
        [_mainView setTableViewFrameWithTop:0 left:0 right:0 bottom:0];
        [_mainView.tableView registerNib:[UINib nibWithNibName:@"B_BusinessLiseTVC" bundle:nil] forCellReuseIdentifier:@"B_BusinessLiseTVC"];
        _mainView.numberOfSectionsBlock = ^NSInteger(UITableView *tableView) {
            return 1;
        };
        
        _mainView.numberOfRowsBlock = ^NSInteger(UITableView *tableView, NSInteger section) {
            return weSelf.dataArray.count;
        };
        
        _mainView.heightForHeaderBlock = ^CGFloat(UITableView *tableView, NSInteger section) {
            return 215;
        };
        
        _mainView.viewForHeaderBlock = ^UIView *(UITableView *tableView, NSInteger section) {
            B_BusinessHeaderView * headerView = [B_BusinessHeaderView initB_BusinessHeaderView];
            headerView.B_userImageView.backgroundColor = [UIColor redColor];
            headerView.B_userLabel.text = @"易小川";
            headerView.B_allGoodsLabel.text = [NSString stringWithFormat:@"共%@件商品", @"20"];
            return headerView;
        };
        
        _mainView.heightForRowBlock = ^CGFloat(UITableView *tableView, NSIndexPath *indexPath) {
            return 140;
        };
        
        _mainView.cellForRowBlock = ^UITableViewCell *(UITableView *tableView, NSIndexPath *indexPath) {
            B_BusinessLiseTVC * cell = [tableView dequeueReusableCellWithIdentifier:@"B_BusinessLiseTVC" forIndexPath:indexPath];
            
            cell.B_goodsImageView.backgroundColor = [UIColor redColor];
            cell.B_goodsTitle.text = @"呷哺呷哺";
            cell.B_goodsPrice.text = [NSString stringWithFormat:@"¥%@", @"199"];
            return cell;
        };
        
        
    }
    return _mainView;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
